﻿Public MustInherit Class PrintItem

	Public x1, y1, x2, y2 As Integer
	Public Indent As Padding
	Public Hidden As Boolean
	Public Thickness As Integer = 1
	Public ForScreen As Boolean
	Public Flexible As Boolean
	Public RowSpan As Integer = 1
	Public TextHeight As Single
	Public Fit As Boolean

	Dim Attributes As New SortedList

	MustOverride Sub Draw(ByVal G As Graphics, Path As Drawing2D.GraphicsPath)

	WriteOnly Property Location() As Point
		Set(ByVal Value As Point)
			x1 = Value.X
			y1 = Value.Y
		End Set
	End Property

	WriteOnly Property Size() As Size
		Set(ByVal Value As Size)
			x2 = x1 + Value.Width
			y2 = y1 + Value.Height
		End Set
	End Property

	Property Attribute(ByVal Key As String) As Object
		Get
			Return Attributes(Key)
		End Get
		Set(ByVal Value As Object)
			If Attributes.ContainsKey(Key) Then Attributes.Remove(Key)
			Attributes.Add(Key, Value)
		End Set
	End Property

	ReadOnly Property LinePen() As Pen
		Get
			If Not ForScreen Then Return New Pen(Color.Gray, Thickness)
			Dim ActualThickness As Single = Thickness / 4
			If ActualThickness < 1 Then Return New Pen(Color.FromArgb(255 * ActualThickness, Color.Black), 1)
			Return New Pen(Color.Black, Thickness)
		End Get
	End Property

End Class